package com.xhsj.user.lsm.web;

import com.xhsj.user.lsm.service.TbBadgesProcessTaskService;
import com.xhsj.user.utils.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

//import org.springframework.security.access.prepost.PreAuthorize;


/**
 * <p>
 * 任务表 前端控制器
 * </p>
 *
 * @author suxiaolin
 * @since 2020-03-16
 */
@Api(tags = "任务表")
@RestController
@RequestMapping("/process/tbBadgesProcessTask")
public class TbBadgesProcessTaskController {

	@Autowired
    public TbBadgesProcessTaskService service;

    @ApiOperation(value = "查询审核任务数据", notes = "查询审核任务数据。")
    @RequestMapping(value="/findAll",method = RequestMethod.GET)
    public Message findAll(){
        return Message.success("成功",service.selectAll());
    }



//	@ApiImplicitParam(name = "data", value = " {\n" +
//			"\"page\":1,\n" +
//			"\"size\":10,\n" +
//			"\"userId\":\"277\"\n" +
//			"}", required = true, dataType = "Map")
//	@ApiOperation(value = "查询正在运行的任务列表", notes = "查询正在运行的任务列表")
//	@RequestMapping(value="/findRunTaskList",method = RequestMethod.POST)
//	public Result findRunTaskList(@RequestBody Map<String,Object> data) {
//        try {
//
//			Object userId = data.get("userId");
//			if (Objects.isNull(userId)) {
//				return new Result<>(Result.CODE_FAILED,"userId不能为空");
//			}
//
//			IPage<TaskModel> selectPage = service.findRunTaskList(data);
//        	return new Result<>(Result.CODE_SUCCESS,"",selectPage.getRecords(),selectPage.getTotal(),selectPage.getPages());
//        } catch (Exception e) {
//        	e.printStackTrace();
//        	return new Result<>(Result.CODE_FAILED,"查询异常",e.getMessage());
//        }
//	}

//	@ApiImplicitParam(name = "data", value = "{\n" +
//			"\"page\":1,\n" +
//			"\"size\":10,\n" +
//			"\"userId\":\"277\",\n" +
//			"\"status\":0\n" +
//			"}", required = true, dataType = "Map")
//	@ApiOperation(value = "查询历史任务表所有数据list", notes = "查询历史任务表所有数据list。")
//	@RequestMapping(value="/findHiTaskList",method = RequestMethod.POST)
//    //@PreAuthorize("hasAuthority('tb:badges:process:task:view')")
//	public Result findHiTaskList(@RequestBody Map<String,Object> data){
//		if (Objects.isNull(data.get("userId"))) {
//			return new Result<>(Result.CODE_FAILED,"userId不能为空");
//		}
//
//		if (Objects.isNull(data.get("status"))) {
//			return new Result<>(Result.CODE_FAILED,"状态不能为空");
//		}
//		IPage<TaskModel> selectPage = service.findHiTaskList(data);
//
//		return new Result<>(Result.CODE_SUCCESS,"",selectPage.getRecords(),selectPage.getTotal(),selectPage.getPages());
//	}

}

